package com.erp.erp_ui.Customer2Log;


import com.erp.erp_entitys.Customer2Log.Customer2LogEntity;
import com.erp.erp_entitys.Customer2Log.Customer2LogExample;
import com.erp.erp_servers.Customer2Log.ICustomer2LogService;
import com.erp.utils.R;
import com.erp.utils.ResultStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 客户日志
 * @ClassName CustomerContactControl
 * @Description TODO
 * @Author songjizhen
 * @Date 2020-07-03 23:07
 * @Version 1.0
 */
@Controller
@RequestMapping(value = "customer2log")
public class Customer2LogControl {
    @Autowired
    ICustomer2LogService customerLogService;

    /**
     * 分页获取日志
     * @return
     */
    @RequestMapping(value = "selectByPage")
    @ResponseBody
    public R<List<Customer2LogEntity>> selectByPage(String companycode){
        try {
            Customer2LogExample example=new Customer2LogExample();
            Customer2LogExample.Criteria criteria = example.createCriteria();
            criteria.andCodeLike("%"+companycode+"%");
            List<Customer2LogEntity> customerLogEntities = customerLogService.selectByExample(example);
            return R.build(customerLogEntities);
        }catch (Exception e){
            e.printStackTrace();
            return R.buildError(ResultStatusEnum.ERROR);
        }
    }
}
